#pragma once

class CelestialPlanet:
	public ICelestial
{
public:
	CelestialPlanet(const NodeCreation& nc);
	~CelestialPlanet();

	/*-IRenderableObject--------------------------------------------------------*/
	void			RenderableBinder(uint treeCalcFlags);
	void			RenderableHelper(const uint i, ERenderQuality::Type quality, uint pendingInstances);

	/*---ICelestial-------------------------------------------------------------*/
	void			GenerateContent();
	void			DestroyContent();
	void			DoMovement();

	/*--------------------------------------------------------------------------*/

	float			GetPlanetRadius();
	float			GetAtmosphereRadius();
	float			GetMaxHeight();

	glm::vec3		RotateN(const glm::vec2& pos2d, EQuadLocation::Enum location);
	glm::vec3		RotateN(const glm::vec3& pos3d, EQuadLocation::Enum location);

	glm::vec3		Rotate(const glm::vec2& pos2d, EQuadLocation::Enum location);
	glm::vec3		Rotate(const glm::vec3& pos3d, EQuadLocation::Enum location);

	float			Height(const glm::vec3& nvec);
	glm::vec3		Normal(const glm::vec2& pos2d, EQuadLocation::Enum location);
	glm::vec3		Position(const glm::vec3& nvec);

	glm::vec3		TranslationVector(EQuadLocation::Enum location);

private:
	CelestialPlanetQuad**	m_quads;

	float					m_planetRadius;
	float					m_atmosphereRadius;
	float					m_maxHeight;

	Atmosphere*				m_atmosphere;

	noise::module::Perlin	m_smallScale;
	noise::module::Perlin	m_mediumScale;
	noise::module::Perlin	m_largeScale;

public:
	static glm::mat4		farRotMatrix;
	static glm::mat4		nearRotMatrix;
	static glm::mat4		leftRotMatrix;
	static glm::mat4		rightRotMatrix;
	static glm::mat4		topRotMatrix;
	static glm::mat4		bottomRotMatrix;
};

